stub spec that was making real HTTP call

Andrew Cantino 8 ans auparavant
Parent
Commettre
a61bcc60cb
2 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 4 0
      spec/controllers/agents_controller_spec.rb
  2. 1 1
      spec/support/vcr_support.rb

+ 4 - 0
spec/controllers/agents_controller_spec.rb

@@ -349,6 +349,10 @@ describe AgentsController do
349 349
   end
350 350
 
351 351
   describe "POST dry_run" do
352
+    before do
353
+      stub_request(:any, /xkcd/).to_return(body: File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), status: 200)
354
+    end
355
+
352 356
     it "does not actually create any agent, event or log" do
353 357
       sign_in users(:bob)
354 358
       expect {

+ 1 - 1
spec/support/vcr_support.rb

@@ -2,7 +2,7 @@ require 'vcr'
2 2
 
3 3
 VCR.configure do |c|
4 4
   c.cassette_library_dir = 'spec/cassettes'
5
-  c.allow_http_connections_when_no_cassette = true
5
+  c.allow_http_connections_when_no_cassette = false
6 6
   c.hook_into :webmock
7 7
   c.default_cassette_options = { record: :new_episodes}
8 8
   c.configure_rspec_metadata!